<template>
  <div class="home">
    <button @click="getClickFn">发送一个get请求</button>
    <button @click="postClickFn">发送一个post请求</button>
  </div>
</template>

<script>
// 按需导入
import { HomeApi, PostLoginApi } from "../request/api";
export default {
  name: "Home",
  methods: {
    // 发送一个get请求
    getClickFn() {
      HomeApi().then((res) => {
        console.log(res);
      });
    },
    // 发送一个post请求
    postClickFn() {
      PostLoginApi({
        username: "雨下林",
        pwd: "123456",
      }).then((res) => {
        console.log(res);
      });
    },
  },
};
</script>
